<?php if (!defined('THINK_PATH')) exit();?><div class="bjui-pageHeader">
    <div class="pull-right">
    <?php if(I('type') == '2'): ?><input type="checkbox" name="lookupType" value="1" data-toggle="icheck" data-label="追加" checked>
         <button type="button" class="btn-blue" data-toggle="lookupback" data-lookupid="ids" data-warn="请至少选择一项" data-icon="check-square-o">选择勾选</button>
    <?php else: ?>
        <button class="btn-default" data-icon="plus" title="新增属性" data-toggle="tooltip" data-placement="left" onclick="createDialog('<?php echo U("Forms/attr");?>', '新增属性', 'attr', {width:700, height:500})"></button>
        <a href="<?php echo U('Forms/del_attr');?>" class="btn btn-default" data-toggle="doajaxchecked" data-icon="remove" data-callback="callbackRefres" data-confirm-msg="要删除全部选中的吗??" data-idname="id" data-group="ids"></a>
        <button class="btn-default" data-icon="refresh" onclick="$.CurrentNavtab.navtab('refresh')"></button><?php endif; ?>
    </div>
    <form id="pagerForm" data-toggle="ajaxsearch" data-loadingmask="true" action="<?php echo U('attr');?>" method="post">
        <input type="hidden" name="pageSize" value="<?php echo I('param.pageSize');?>" />
        <input type="hidden" name="pageCurrent" value="<?php echo I('param.pageCurrent');?>" />
        <input type="hidden" name="orderField" value="<?php echo I('param.orderField');?>" />
        <input type="hidden" name="orderDirection" value="<?php echo I('param.orderDirection');?>" />
        <input type="hidden" name="type" value="<?php echo I('type');?>"/>
        <div class="bjui-searchBar">
            <label>规格名称:</label>
            <input type="text" name="name" value="<?php echo I('name');?>"/>
            <button type="submit" class="btn-default" data-icon="search">查询</button>
            <a class="btn btn-orange" href="javascript:;" data-toggle="reloadsearch" data-clear-query="true" data-icon="undo">清空查询 </a>
        </div>
    </form>
</div>
<div class="bjui-pageContent tableContent">
    <table class="table table-bordered table-hover table-striped table-top" data-selected-multi="false">
        <thead>
            <tr>
                <th width="26"><input type="checkbox" class="checkboxCtrl" data-group="ids" data-toggle="icheck"></th>
                <th>属性名称</th>
                <th>输入方式</th>
                <th>可选值</th>
                <th width="50">筛选</th>
                <th width="50">权重</th>
                <th width="100">操作</th>
            </tr>
        </thead>
        <tbody>
        <?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i; switch($vo['type']){ case '1': $typename = "单选"; break; case '2': $typename = "多选"; break; case '3': $typename = "下拉"; break; case '4': $typename = "文本输入"; break; case '5': $typename = "多行文本输入"; break; }; ?>
        <tr>
            <?php if(I('type') == '2'): ?><td width="26"><input type="checkbox" value="{id:<?php echo $vo['id'] ?>, attr_name:'<?php echo $vo['name'] ?>',attr_input:'<?php echo $typename ?>',attr_item:'<?php echo str_replace(',','_',$vo['value']) ?>'}" class="checkboxCtrl" name="ids" data-toggle="icheck"></td>
            <?php else: ?>
               <th width="26"><input type="checkbox" value="<?php echo ($vo["id"]); ?>" class="checkboxCtrl" name="ids" data-toggle="icheck"></th><?php endif; ?>
            <td><?php echo ($vo["name"]); ?></td>
            <td>
            <?php echo ($typename); ?>
            </td>
            <td><?php echo ($vo["value"]); ?></td>
            <td><?php if($vo["search"] == '0'): ?>否<?php else: ?>是<?php endif; ?></td>
            <td><?php echo ($vo["sort"]); ?></td>
            <td>
            <?php if(I('type') == '2'): ?><button type="button" class="btn-green" data-toggle="lookupback" data-args="{id:<?php echo $vo['id'] ?>, attr_name:'<?php echo $vo['name'] ?>',attr_input:'<?php echo $typename ?>',attr_item:'<?php echo str_replace(',','_',$vo['value']) ?>'}">选</button>
            <?php else: ?>
                <button type="button" class="btn-blue" onclick="createDialog('<?php echo U("Forms/attr",array("id"=>$vo["id"]));?>', '修改属性', 'attr' ,{width:700, height:500})">改</button>
                <a href="<?php echo U('Forms/del_attr',array('id'=>$vo['id']));?>" data-type="get" class="btn btn-red" data-toggle="doajax" data-confirm-msg="确定要删除这个属性?" >删</a><?php endif; ?>
            </td>
        </tr><?php endforeach; endif; else: echo "" ;endif; ?>
        </tbody>
    </table>
</div>

<div class="bjui-pageFooter">
		
	<?php if(page == save): ?><ul>
			<li><button type="submit" class="btn-default" data-icon="save">保存</button></li>
	        <li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
	    </ul>
	<?php elseif(page == close): ?>
	    <ul>
	        <li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
	    </ul>
	<?php elseif(page == page and $show != null): ?>
		<ul>
	        <li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
	    </ul>
		    <div class="pages">
		        <span>每页&nbsp;</span>
		        <div class="selectPagesize">
		            <select data-toggle="selectpicker" data-toggle-change="changepagesize">
		                <option value="<?php echo ($show['listrow']); ?>"><?php echo ($show['listrow']); ?></option>
		                <option value="60">60</option>
		                <option value="120">120</option>
		                <option value="150">150</option>
		            </select>
		        </div>
		        <span>&nbsp;条，共 <?php echo ($show['total']); ?> 条</span>
		    </div>
		    <div class="pagination-box" data-toggle="pagination" data-total="<?php echo ($show['total']); ?>" data-page-size="<?php echo ($show['listrow']); ?>" data-page-current="1">
		    </div>
	<?php elseif(page == page and $show == null): ?>
		<ul>
			<li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
		</ul>
	<?php else: ?>
		<ul>
			<li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
		</ul><?php endif; ?>

</div>